Skip to content

feat(ci): add TDD bug-fix agent and triage cron#1938

Draft
peppescg wants to merge 1 commit intomainfrom
feat/tdd-bug-fix-agent
Draft

feat(ci): add TDD bug-fix agent and triage cron#1938
peppescg wants to merge 1 commit intomainfrom
feat/tdd-bug-fix-agent

Conversation

@peppescg
Copy link
Copy Markdown
Collaborator

@peppescg peppescg commented Apr 8, 2026

Summary

Adds automated bug fixing using a TDD approach with Claude Code agents:

  • Bug-fix agent (_bug-fix-agent.yml): Triggered by auto-fix label on Bug issues. Two-phase TDD — Opus writes a failing test (red), Sonnet applies the minimum fix (green). Up to 3 attempts with 5 internal retries per phase.
  • Trigger workflow (bug-fix-on-label.yml): Fires when auto-fix label is added to a Bug issue.
  • Triage cron (bug-triage-cron.yml): Daily (weekdays 8am UTC) Sonnet evaluates open Bug issues and labels suitable ones with auto-fix (max 3/day).
  • TDD skill (.claude/skills/bug-fix-tdd/): Test patterns, placement rules, and workflow instructions for the agent.

Key design decisions

  • Only comments on issue after all 3 attempts are exhausted (no noise on intermediate failures)
  • Skips issues with human comments, cross-repo fixes (timeline API), and existing PRs
  • Hard gates between phases verify test actually fails/passes (not just agent's word)
  • continue-on-error on TDD step ensures failure comment posts even on timeout
  • Expression injection mitigated by using env vars instead of ${{ }} in run blocks

Configuration

Setting Value
Bug-fix timeout 45 min
Triage timeout 15 min
Max attempts per issue 3
Max internal retries per phase 5
Phase 1 (Opus) max turns 50
Phase 2 (Sonnet) max turns 80
Triage (Sonnet) max turns 20
Triage max issues/day 3
Triage schedule Weekdays 08:00 UTC

Test plan

  • Create a test Bug issue with clear reproduction steps, add auto-fix label, verify agent creates PR
  • Create a vague Bug issue, add auto-fix label, verify agent comments with analysis after 3 attempts
  • Verify deduplication: re-adding auto-fix label doesn't trigger if PR exists
  • Trigger triage cron manually (workflow_dispatch), verify it only labels suitable issues
  • Verify triage skips issues with comments, auto-fix-skip label, and cross-repo fixes

🤖 Generated with Claude Code

Add automated bug fixing via TDD approach:

- Bug-fix agent workflow triggered by `auto-fix` label on Bug issues
- Two-phase TDD: Opus writes failing test (red), Sonnet applies fix (green)
- Up to 3 attempts per issue with 5 internal retries per phase
- Hard gates verify test fails before fix and all checks pass after
- Daily triage cron (Sonnet) evaluates open Bug issues for auto-fix suitability
- Skips issues with comments, cross-repo fixes, and existing PRs
- Only comments on issue after all 3 attempts are exhausted

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant